<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
<link href="css/word.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/check.js"></script>

<script type="text/javascript">
	function gotoPage(){
		var page=document.getElementById("pagesize").value;
		var url="word/gotoWord?pageNow="+page+"&pageSize="+${pageSize}+"&finds=${request.finds}";
		document.location.href=url;
	}
</script>
<div id="WordForm">
	<img src="images/word.png" /> 留言板
	<HR
		style="BORDER-RIGHT: #00686b 1px dotted; BORDER-TOP: #00686b 1px dotted; BORDER-LEFT: #00686b 1px dotted; BORDER-BOTTOM: #00686b 1px dotted"
		noShade SIZE=1>
	<form id="form1" name="form1" id="form1" method="post" action="word/publish"
		onsubmit="return wordCheck()">
		<p>
			发表您的留言：
			<c:if test="${!empty err}">
				${err}
			</c:if>
		</p>
		
		<p>
			<label for="textfield">姓名:</label><input name="word.name"
				type="text" id="name" value="${session.loginuser.name }" size="10">
			<label for="email">邮箱:</label> <input name="word.email" type="email"
				id="email" value="${session.loginuser.email }" size="15"> <label
				for="textfield2">电话:</label> <input name="word.tel" type="text"
				id="tel" value="${session.loginuser.tel }" size="15">

		</p>
		<p>
			<label for="textfield4">验证码:</label> <input name="code" type="text"
				id="code" size="6"> <img src="code?id=${request.Coderandom}" onclick="this.src='code?id='+Math.random()" />
		</p>
		<p>
			<label for="textarea">内容:</label>
			<textarea name="word.info" cols="87" rows="3" id="info"></textarea>
		</p>
		<p>
		<a href="javascript:void(0);" class="sui-btn btn-xlarge btn-primary"
				onclick="document.getElementById('form1').submit();">提交留言</a>
			留言需审核后才能显示
		</p>
	</form>
</div>
<!--留言-->
<div id="Words">

	
	

	<c:forEach items="${request.list}" var="word">
		<!--一个留言-->
		<div id="Word">
			<!--留言标题-->
			<div id="WordTitle">
				<div id="Name"
					style="font-size:14px;color:#201298;font-weight: inherit;">${word.name}</div>
				<div id="Time"
					style="font-size:14px;color:#07A38F;font-weight: inherit;">
					<fmt:formatDate value="${word.date}" pattern="yyyy-MM-dd HH:mm:ss" />
				</div>
			</div>
			<!--留言内容-->
			<div id="Content"
				style="text-indent: 2em;font-size:13px;color:#1A912F;">${word.info}</div>
		</div>
	</c:forEach>
	
	
	<div class="sui-pagination" style="text-align: center">
		<ul>
			<li class="prev "><a
				href="word/gotoWord?pageNow=1&pageSize=${pageSize}&finds=${request.finds}">首页</a></li>
			<li class="prev "><a
				href="word/gotoWord?pageNow=${pageNow-1}&pageSize=${pageSize}&finds=${request.finds}">«上一页</a></li>
			<li class="next"><a
				href="word/gotoWord?pageNow=${pageNow+1}&pageSize=${pageSize}&finds=${request.finds}">下一页»</a></li>
			<li class="prev "><a
				href="word/gotoWord?pageNow=${pageCount}&pageSize=${pageSize}&finds=${request.finds}">末页</a></li>
		</ul>
		<div>
			<span>当前页数 ${ pageNow}/共${ pageCount}页&nbsp;</span><span> 到 <input
				class="page-num" type="text" id="pagesize">
			<button class="page-confirm" onclick="gotoPage()">确定</button> 页
			</span>
		</div>
	</div>
	
	
	<%-- <div style="width:740px;margin-top: 30px;text-align: center;">
		当前页数 ${ pageNow} /总页数 ${ pageCount} 每页记录 ${ pageSize}/总记录 ${ rowsCount}<br />
		<input name="first" id="first" type="button" value="首页"
			onclick="gotoPage(this.name);" /><input id="back" name="back"
			type="button" value="上页" onclick="gotoPage(this.name)" /> <input
			id="next" name="next" type="button" value="下页"
			onclick="gotoPage(this.name)" /><input id="last" name="last"
			type="button" value="末页" onclick="gotoPage(this.name)" />
	</div> --%>
</div>